<ui:composition template="mainTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets" 
                xmlns:p="http://primefaces.org/ui"
                >
    <ui:define name="title">Upload</ui:define>

    <ui:define name="content">

        <h:form enctype="multipart/form-data" rendered="#{userController.loggedIn}">

            <p:messages/>

            <h:panelGrid columns="2">
                Name
                <p:inputText value="#{fileUploadController.name}"/>

                Description
                <p:inputText value="#{fileUploadController.description}"/>

                Category
                <h:selectOneMenu value="#{fileUploadController.category}">
                    <f:selectItems value="#{fileUploadController.categories}" var="cat"
                                   itemLabel="#{cat.name}" itemValue="#{cat.id}" />
                </h:selectOneMenu>

                File
                <p:fileUpload value="#{fileUploadController.file}" mode="simple"/>  
            </h:panelGrid>
            <p:commandButton value="Submit" ajax="false"  
                             actionListener="#{fileUploadController.upload}"/>  

        </h:form>
    </ui:define>
</ui:composition>